import 'dart:async';

class TransferDataController {
  StreamController<Map<String,Object>> _dataController;
  TransferDataController(this._dataController);
  static instance() {
    return new TransferDataController(StreamController.broadcast());
  }

  StreamSink<Map<String,Object>> get dataSink => _dataController.sink;

  Stream<Map<String,Object>> get dataStream => _dataController.stream;

  static close(StreamSubscription _dataSubscription) {
    _dataSubscription.cancel();
  }

  addListen(Object obj) {
    dataSink.add(obj);
  }

  addDataSample(String name,String type,Object val) {
    dataSink.add({name:{type:val}});
  }
}
